package com.dm.dm_project.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * [说明/描述]
 *
 * @author 徐杜伟
 * @version 版本号
 * @date 2023/10/30
 */
@RestController
public class DbController {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @GetMapping("/queryDbVersion")
    public List queryDbVersion(){
        return jdbcTemplate.queryForList("SELECT banner as 版本信息 FROM v$version");
    }

    @GetMapping("/wb_meter")
    public List getWeMeter(){
        return jdbcTemplate.queryForList("select * from wb_meter limit 50;");
    }

    @GetMapping("/opt")
    public String insertOptTotal(){
        jdbcTemplate.execute("INSERT INTO OPT_TOTAL VALUES(LOWER(SYS_GUID()),'java',SYSDATE());");
        return "ok";
    }
}
